//
//  TCLYIntegralView.m
//  YuErmuYing
//
//  Created by LYang on 16/9/2.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "TCLYIntegralView.h"
#import "Macros.h"
#import "Masonry.h"

@implementation TCLYIntegralView 
-(instancetype)initWithFrame:(CGRect)frame ImageArr:(NSArray *)imageArr{
    if (self = [super initWithFrame:frame]) {
        
        self.backgroundColor = [UIColor whiteColor];

       self.cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, screenWidth, 125) imagesGroup:imageArr];
        self.cycleScrollView.infiniteLoop = YES;
        self.cycleScrollView.delegate = self;
//        cycleScrollView.titlesGroup = titlesArr;
        self.cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
        self.cycleScrollView.autoScrollTimeInterval = 3.0;
        self.cycleScrollView.dotColor = [UIColor whiteColor];
        [self addSubview:self.cycleScrollView];
//        [self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
//            make.left.mas_equalTo(self);
//            make.right.mas_equalTo(self);
//            make.top.mas_equalTo(self);
//            make.height.mas_equalTo(125);
//        }];
        //食品饮料功能按钮
        self.foodsBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.foodsBtn setImage:[UIImage imageNamed:@"integralHomeBtn2"] forState:UIControlStateNormal];
        [self addSubview:self.foodsBtn];
        [self.foodsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(self);
            make.top.mas_equalTo(self.cycleScrollView.mas_bottom).offset(10);
            make.width.mas_equalTo(72);
            make.height.mas_equalTo(72);
        }];
        //母婴商品
        self.goodsBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.goodsBtn setImage:[UIImage imageNamed:@"integralHomeBtn1"] forState:UIControlStateNormal];
        [self addSubview:self.goodsBtn];
        [self.goodsBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.foodsBtn);
            make.left.mas_equalTo(42);
            make.width.mas_equalTo(72);
            make.height.mas_equalTo(72);
        }];
        //更多按钮
        self.moreBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [self.moreBtn setImage:[UIImage imageNamed:@"更多"] forState:UIControlStateNormal];
        [self addSubview:self.moreBtn];
        [self.moreBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.foodsBtn);
            make.right.mas_equalTo(-42);
            make.width.mas_equalTo(72);
            make.height.mas_equalTo(72);
        }];
    }
    return self;
}

- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index{
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
